//
//  IntroductionViewController.m
//  Movie
//
//  Created by cjy on 16/3/30.
//  Copyright © 2016年 HY. All rights reserved.
//

#import "IntroductionViewController.h"
#import <UIImageView+WebCache.h>
#import "PlayerViewController.h"
#import "MovieModel.h"
@interface IntroductionViewController ()

@property (nonatomic,strong)UIImageView *playView;
@property (nonatomic,strong)UIImageView *imageV;
@property (nonatomic,strong)UIImageView *imagedown;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIView *lineView;
@property (nonatomic,strong)UILabel *littleLabel;
@property (nonatomic,strong)UILabel *descripLabel;
@end

@implementation IntroductionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    self.navigationItem.title = self.titlea;
    
    _imageV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height / 2)];
    
    [_imageV sd_setImageWithURL:[NSURL URLWithString:self.icon] placeholderImage:[UIImage imageNamed:@"zwt"]];
    [self.view addSubview:_imageV];
    
    _imageV.userInteractionEnabled = YES;
    
    
    //
    _playView = [[UIImageView alloc]initWithFrame:CGRectMake((kWidth - 100) / 2, (kHeight/1.7 - 130) / 2 , 100, 100)];
    _playView.image = [UIImage imageNamed:@"video-play"];
    
    [_imageV addSubview:_playView];
    
    
    
    _imagedown = [[UIImageView alloc]initWithFrame:CGRectMake(0,self.view.frame.size.height / 2 +64, self.view.frame.size.width, self.view.frame.size.height / 2)];
    
    [_imagedown sd_setImageWithURL:[NSURL URLWithString:_icon] placeholderImage:[UIImage imageNamed:@"zwt"]];
    [self.view addSubview:self.imagedown];

    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:1];
        UIVisualEffectView *visualView = [[UIVisualEffectView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height / 2)];
        visualView.effect = blur;
    
        [_imagedown addSubview:visualView];
    
    
    
    
    _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 5, [UIScreen mainScreen].bounds.size.width, 30)];
    _titleLabel.font = [UIFont boldSystemFontOfSize:16];
    _titleLabel.text = self.titlea;
    _titleLabel.textColor = [UIColor whiteColor];
    [visualView addSubview:_titleLabel];
    
    _lineView = [[UIView alloc]initWithFrame:CGRectMake(5, 35, 240, 1)];
    _lineView.backgroundColor = [UIColor whiteColor];
    [visualView addSubview:_lineView];

    _littleLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 46, [UIScreen mainScreen].bounds.size.width, 20)];
    _littleLabel.textColor = [UIColor whiteColor];
    _littleLabel.font = [UIFont systemFontOfSize:14];
    [visualView addSubview:_littleLabel];
    
    // 转换时间
    NSInteger time = self.duration;
    
    NSString *timeString = [NSString stringWithFormat:@"%02ld'%02ld''",time/60,time% 60];//显示的是音乐的总时间
    
    NSString *string = [NSString stringWithFormat:@"#%@ / %@",self.little, timeString];

    _littleLabel.text = string;

    
    
    _descripLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 80, [UIScreen mainScreen].bounds.size.width - 10, 90)];
    _descripLabel.font = [UIFont systemFontOfSize:14];
    _descripLabel.text = self.des;
    _descripLabel.numberOfLines = 0;
    _descripLabel.textColor = [UIColor whiteColor];
    [visualView addSubview:_descripLabel];
    

    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction)];
    
    [_imageV addGestureRecognizer:tap];

    
    
    
}


- (void)tapAction{

    PlayerViewController *play = [[PlayerViewController alloc]init];
    
    
    
    play.UrlString = self.playUrl;
    play.receiveModel = _model;
    
    [self showDetailViewController:play sender:nil];
    


}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
